#ifndef SELLER_H
#define SELLER_H

#include <QObject>
#include <QDateTime>
#include <QMap>
#include <QMetaType>

struct cs8SalePerDay {
    double turnOver;
    double share;
    int qtyParts;
};

typedef  QMap<QDate,cs8SalePerDay> cs8ReportData;
typedef  QMap<QString,cs8ReportData> cs8ReportDataList;

typedef QMapIterator<QString,cs8ReportData> cs8ReportDataIterator;
typedef QMapIterator<QDate,cs8SalePerDay> cs8SalePerDayIterator;

class sale : public QObject
{
    Q_OBJECT

public:
    explicit sale(const QDateTime & transaction, const QString & posName, int quantity, double price);
    double total() const;
    QDateTime timeStamp() const;
    int quantity() const;
    double price() const;
    QString pos() const;


protected:
    int m_quantity;
    double m_price, m_total;
    QString m_pos;
    QDateTime m_transaction;
};

class cs8Seller : public QObject
{
    Q_OBJECT
public:
    explicit cs8Seller(QObject *parent = 0);
    QMap<QDateTime,sale*> sales() const;
    void addSale(const QDateTime & transaction, const QString & posName, int quantity, double price);
    void clearSales();
    double totalSum();
    void setTotalSum(double total);
    void setName(const QString & name);
    QString name() const;

signals:

public slots:


protected:
    QString m_name;
    double m_totalSum;
    QMap<QDateTime, sale *> m_sales;

};

Q_DECLARE_METATYPE(cs8Seller*)

#endif // SELLER_H
